package io.kiki.sba.registry.server.data_store.remoting.metaserver.provideData;

import io.kiki.sba.registry.common.model.metaserver.ProvideData;
import io.kiki.sba.registry.server.shared.providedata.ProvideDataProcessor;

import java.util.ArrayList;
import java.util.List;


public class ProvideDataProcessorManager implements ProvideDataProcessor {

    private final List<ProvideDataProcessor> list = new ArrayList<>();

    public void addProvideDataProcessor(ProvideDataProcessor provideDataProcessor) {
        list.add(provideDataProcessor);
    }

    @Override
    public boolean processData(ProvideData provideData) {
        for (ProvideDataProcessor provideDataProcessor : list) {
            if (provideDataProcessor.support(provideData.getDataInfoId())) {
                provideDataProcessor.processData(provideData);
            }
        }

        return true;
    }

    @Override
    public boolean support(String dataInfoId) {
        return false;
    }
}
